package com.xft.rabbitmq.rabbit.object;


import com.xft.rabbitmq.model.User;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author xft
 * @date 2018/3/19  12:25
 */
@Component
public class ObjectSender {
    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send(User user) {
        System.out.println("Sender object:" + user);
        this.rabbitTemplate.convertAndSend("object", user);
    }
}
